<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node442.html" />
<link rel="prev" href="module-platform.html" />
<link rel="parent" href="module-platform.html" />
<link rel="next" href="node442.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>14.12.1 Cross Platform</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="14.12 platform  "
  href="module-platform.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="14.12 platform  "
  href="module-platform.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="14.12.2 java Platform"
  href="node442.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-platform.html">14.12 platform  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-platform.html">14.12 platform  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node442.html">14.12.2 Java Platform</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION00161210000000000000000">
14.12.1 Cross Platform</a>
</h2>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3166' xml:id='l2h-3166' class="function">architecture</tt></b>(</nobr></td>
  <td><var>executable=sys.executable, bits='', linkage=''</var>)</td></tr></table></dt>
<dd>
  Queries the given executable (defaults to the Python interpreter
  binary) for various architecture information.

<p>
Returns a tuple <code>(bits, linkage)</code> which contain information about
  the bit architecture and the linkage format used for the
  executable. Both values are returned as strings.

<p>
Values that cannot be determined are returned as given by the
  parameter presets. If bits is given as <code>''</code>, the
  <tt class="cfunction">sizeof(pointer)</tt>
  (or <tt class="cfunction">sizeof(long)</tt> on Python version &lt; 1.5.2) is used as
  indicator for the supported pointer size.

<p>
The function relies on the system's <span class="file">file</span> command to do the
  actual work. This is available on most if not all <span class="Unix">Unix</span> 
  platforms and some non-<span class="Unix">Unix</span> platforms and then only if the
  executable points to the Python interpreter.  Reasonable defaults
  are used when the above needs are not met.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3167' xml:id='l2h-3167' class="function">machine</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the machine type, e.g. <code>'i386'</code>.
  An empty string is returned if the value cannot be determined.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3168' xml:id='l2h-3168' class="function">node</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the computer's network name (may not be fully qualified!).
  An empty string is returned if the value cannot be determined.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3169' xml:id='l2h-3169' class="function">platform</tt></b>(</nobr></td>
  <td><var>aliased=0, terse=0</var>)</td></tr></table></dt>
<dd>
  Returns a single string identifying the underlying platform
  with as much useful information as possible.

<p>
The output is intended to be <em>human readable</em> rather than
  machine parseable. It may look different on different platforms and
  this is intended.

<p>
If <var>aliased</var> is true, the function will use aliases for various
  platforms that report system names which differ from their common
  names, for example SunOS will be reported as Solaris.  The
  <tt class="function">system_alias()</tt> function is used to implement this.

<p>
Setting <var>terse</var> to true causes the function to return only the
  absolute minimum information needed to identify the platform.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3170' xml:id='l2h-3170' class="function">processor</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the (real) processor name, e.g. <code>'amdk6'</code>.

<p>
An empty string is returned if the value cannot be determined. Note
  that many platforms do not provide this information or simply return
  the same value as for <tt class="function">machine()</tt>.  NetBSD does this.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3171' xml:id='l2h-3171' class="function">python_build</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns a tuple <code>(<var>buildno</var>, <var>builddate</var>)</code> stating the
  Python build number and date as strings.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3172' xml:id='l2h-3172' class="function">python_compiler</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns a string identifying the compiler used for compiling Python.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3173' xml:id='l2h-3173' class="function">python_version</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the Python version as string <code>'major.minor.patchlevel'</code>

<p>
Note that unlike the Python <code>sys.version</code>, the returned value
  will always include the patchlevel (it defaults to 0).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3174' xml:id='l2h-3174' class="function">python_version_tuple</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the Python version as tuple <code>(<var>major</var>, <var>minor</var>,
  <var>patchlevel</var>)</code> of strings.

<p>
Note that unlike the Python <code>sys.version</code>, the returned value
  will always include the patchlevel (it defaults to <code>'0'</code>).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3175' xml:id='l2h-3175' class="function">release</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the system's release, e.g. <code>'2.2.0'</code> or <code>'NT'</code>
  An empty string is returned if the value cannot be determined.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3176' xml:id='l2h-3176' class="function">system</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the system/OS name, e.g. <code>'Linux'</code>, <code>'Windows'</code>,
  or <code>'Java'</code>.
  An empty string is returned if the value cannot be determined.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3177' xml:id='l2h-3177' class="function">system_alias</tt></b>(</nobr></td>
  <td><var>system, release, version</var>)</td></tr></table></dt>
<dd>
  Returns <code>(<var>system</var>, <var>release</var>, <var>version</var>)</code> aliased
  to common marketing names used for some systems.  It also does some
  reordering of the information in some cases where it would otherwise
  cause confusion.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3178' xml:id='l2h-3178' class="function">version</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns the system's release version, e.g. <code>'#3 on degas'</code>.
  An empty string is returned if the value cannot be determined.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3179' xml:id='l2h-3179' class="function">uname</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Fairly portable uname interface. Returns a tuple of strings
  <code>(<var>system</var>, <var>node</var>, <var>release</var>, <var>version</var>,
  <var>machine</var>, <var>processor</var>)</code> identifying the underlying
  platform.

<p>
Note that unlike the <tt class="function">os.uname()</tt> function this also returns
  possible processor information as additional tuple entry.

<p>
Entries which cannot be determined are set to <code>''</code>.
</dl>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="14.12 platform  "
  href="module-platform.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="14.12 platform  "
  href="module-platform.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="14.12.2 java Platform"
  href="node442.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-platform.html">14.12 platform  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-platform.html">14.12 platform  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node442.html">14.12.2 Java Platform</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
